package Blog0;


interface Talk {

    void speak();    // 抽象方法 默认为 public void
}

class Chinese implements Talk{
    String language = null;
    public Chinese(String language) {
        this.language = language;
    }

    @Override
    public void speak() {
        System.out.println(this.language+": 你好世界");
    }
}

class English implements Talk {
    String language = null;

    public English(String language) {
        this.language = language;
    }

    @Override
    public void speak() {
        System.out.println(this.language+": Hello World");

    }

}

class French implements Talk {
    String language = null;

    public French(String language) {
        this.language = language;
    }

    @Override
    public void speak() {
        System.out.println(this.language+": Bonjour le monde");
    }
}


public class Blog09 {
    public static void main(String[] args) {
        Talk[] talks = new Talk[] {
                new Chinese("汉语"),
                new English("英语"),
                new French("法语")
        };

        for (int i = 0; i < talks.length; i++) {
            talks[i].speak();
        }
    }

}
